package com.sjgs.gis.service.dto;

import java.io.Serializable;
import java.util.Objects;

import com.sjgs.gis.web.rest.NodeResource;
import io.github.jhipster.service.Criteria;
import com.sjgs.gis.domain.enumeration.NodeStatus;
import io.github.jhipster.service.filter.Filter;
import io.github.jhipster.service.filter.LongFilter;
import io.github.jhipster.service.filter.StringFilter;
import io.github.jhipster.service.filter.InstantFilter;

/**
 * Criteria class for the {@link com.sjgs.gis.domain.Node} entity. This class is used
 * in {@link NodeResource} to receive all the possible filtering options from
 * the Http GET request parameters.
 * For example the following could be a valid request:
 * {@code /nodes?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
 * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
 * fix type specific filters.
 */
public class NodeCriteria implements Serializable, Criteria {
    /**
     * Class for filtering NodeStatus
     */
    public static class NodeStatusFilter extends Filter<NodeStatus> {

        public NodeStatusFilter() {
        }

        public NodeStatusFilter(NodeStatusFilter filter) {
            super(filter);
        }

        @Override
        public NodeStatusFilter copy() {
            return new NodeStatusFilter(this);
        }

    }

    private static final long serialVersionUID = 1L;

    private LongFilter id;

    private StringFilter nodeInstanceId;

    private StringFilter nodeAddr;

    private StringFilter version;

    private StringFilter warUrl;

    private StringFilter dataUrl;

    private InstantFilter createTime;

    private NodeStatusFilter status;

    private LongFilter nodePluginId;

    private LongFilter jdbcClusterId;

    public NodeCriteria() {
    }

    public NodeCriteria(NodeCriteria other) {
        this.id = other.id == null ? null : other.id.copy();
        this.nodeInstanceId = other.nodeInstanceId == null ? null : other.nodeInstanceId.copy();
        this.nodeAddr = other.nodeAddr == null ? null : other.nodeAddr.copy();
        this.version = other.version == null ? null : other.version.copy();
        this.warUrl = other.warUrl == null ? null : other.warUrl.copy();
        this.dataUrl = other.dataUrl == null ? null : other.dataUrl.copy();
        this.createTime = other.createTime == null ? null : other.createTime.copy();
        this.status = other.status == null ? null : other.status.copy();
        this.nodePluginId = other.nodePluginId == null ? null : other.nodePluginId.copy();
        this.jdbcClusterId = other.jdbcClusterId == null ? null : other.jdbcClusterId.copy();
    }

    @Override
    public NodeCriteria copy() {
        return new NodeCriteria(this);
    }

    public LongFilter getId() {
        return id;
    }

    public void setId(LongFilter id) {
        this.id = id;
    }

    public StringFilter getNodeInstanceId() {
        return nodeInstanceId;
    }

    public void setNodeInstanceId(StringFilter nodeInstanceId) {
        this.nodeInstanceId = nodeInstanceId;
    }

    public StringFilter getNodeAddr() {
        return nodeAddr;
    }

    public void setNodeAddr(StringFilter nodeAddr) {
        this.nodeAddr = nodeAddr;
    }

    public StringFilter getVersion() {
        return version;
    }

    public void setVersion(StringFilter version) {
        this.version = version;
    }

    public StringFilter getWarUrl() {
        return warUrl;
    }

    public void setWarUrl(StringFilter warUrl) {
        this.warUrl = warUrl;
    }

    public StringFilter getDataUrl() {
        return dataUrl;
    }

    public void setDataUrl(StringFilter dataUrl) {
        this.dataUrl = dataUrl;
    }

    public InstantFilter getCreateTime() {
        return createTime;
    }

    public void setCreateTime(InstantFilter createTime) {
        this.createTime = createTime;
    }

    public NodeStatusFilter getStatus() {
        return status;
    }

    public void setStatus(NodeStatusFilter status) {
        this.status = status;
    }

    public LongFilter getNodePluginId() {
        return nodePluginId;
    }

    public void setNodePluginId(LongFilter nodePluginId) {
        this.nodePluginId = nodePluginId;
    }

    public LongFilter getJdbcClusterId() {
        return jdbcClusterId;
    }

    public void setJdbcClusterId(LongFilter jdbcClusterId) {
        this.jdbcClusterId = jdbcClusterId;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final NodeCriteria that = (NodeCriteria) o;
        return
            Objects.equals(id, that.id) &&
            Objects.equals(nodeInstanceId, that.nodeInstanceId) &&
            Objects.equals(nodeAddr, that.nodeAddr) &&
            Objects.equals(version, that.version) &&
            Objects.equals(warUrl, that.warUrl) &&
            Objects.equals(dataUrl, that.dataUrl) &&
            Objects.equals(createTime, that.createTime) &&
            Objects.equals(status, that.status) &&
            Objects.equals(nodePluginId, that.nodePluginId) &&
            Objects.equals(jdbcClusterId, that.jdbcClusterId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
        id,
        nodeInstanceId,
        nodeAddr,
        version,
        warUrl,
        dataUrl,
        createTime,
        status,
        nodePluginId,
        jdbcClusterId
        );
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "NodeCriteria{" +
                (id != null ? "id=" + id + ", " : "") +
                (nodeInstanceId != null ? "nodeInstanceId=" + nodeInstanceId + ", " : "") +
                (nodeAddr != null ? "nodeAddr=" + nodeAddr + ", " : "") +
                (version != null ? "version=" + version + ", " : "") +
                (warUrl != null ? "warUrl=" + warUrl + ", " : "") +
                (dataUrl != null ? "dataUrl=" + dataUrl + ", " : "") +
                (createTime != null ? "createTime=" + createTime + ", " : "") +
                (status != null ? "status=" + status + ", " : "") +
                (nodePluginId != null ? "nodePluginId=" + nodePluginId + ", " : "") +
                (jdbcClusterId != null ? "jdbcClusterId=" + jdbcClusterId + ", " : "") +
            "}";
    }

}
